# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.spark_submit import SparkSubmitOperator
from jms.dim.dim_tab_rou_main_city import jms_dim__dim_tab_rou_main_city
from jms.dm.route.dm_route_fast_and_slow import dm__dm_route_fast_and_slow
from jms.dim.tms.dim_yl_tms_bulk_cargo_shift_base import jms_dim__dim_yl_tms_bulk_cargo_shift_base
from jms.time_sensor import time_after_04_00


dm__dm_route_city_fast_and_slow = SparkSubmitOperator(
    conn_id='spark_route',
    task_id='dm__dm_route_city_fast_and_slow',
    pool_slots=17,
    email=['suning@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='dm__dm_route_city_fast_and_slow',
    driver_memory='32G',
    executor_memory='32G',
    executor_cores=4,
    num_executors=80,
    jars='hdfs:///route/package/graphframes-0.7.0-spark2.3-s_2.11.jar,hdfs:///route/package/common-1.0-SNAPSHOT.jar',
    java_class='com.yunlu.bigdata.jobs.route.export.RouteCityFastAndSlowExport',
    application='hdfs:///route/package/RouteCityFastAndSlowExport.jar',
    application_args=['{{ execution_date | cst_ds }}'],
    execution_timeout=timedelta(hours=5),
)


dm__dm_route_city_fast_and_slow << [
    dm__dm_route_fast_and_slow,
    jms_dim__dim_tab_rou_main_city,
    jms_dim__dim_yl_tms_bulk_cargo_shift_base,
    time_after_04_00
]
